package org.ali.creationalpattern.abstractfactorypattern;

import org.ali.creationalpattern.abstractfactorypattern.color.Color;
import org.ali.creationalpattern.abstractfactorypattern.factory.Factory;
import org.ali.creationalpattern.abstractfactorypattern.factory.SuperFactory;
import org.ali.creationalpattern.abstractfactorypattern.shape.Shape;

/**
 * 抽象工厂模式
 */
public class Main {
    public static void main(String[] args) {
        Factory colorFactory = SuperFactory.getFactory("Color");

        Color red = colorFactory.getColor("Red");
        red.showMessage();

        Color green = colorFactory.getColor("Green");
        green.showMessage();

        Factory shapeFactory = SuperFactory.getFactory("Shape");

        Shape circular = shapeFactory.getShape("Circular");
        circular.showMessage();

        Shape rectangle = shapeFactory.getShape("Rectangle");
        rectangle.showMessage();
    }
}
